home *** CD-ROM | disk | FTP | other *** search
- /*
- LogOopTest.c - A simple object-oriented test of the logging system.
- */
-
- #include "LogToFile.h"
- #include <Memory.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <OSEvents.h>
- #include <oops.h>
-
- /*
- This #pragma indicates that all functions in this file will be logged.
- You can move it to a single routine to log just that routine.
- #pragma options( profile, force_frame )
-
- The opposite of this command is:
- #pragma options( !profile, !force_frame )
- */
- #pragma options( profile, force_frame )
-
-
- class BaseClass : indirect
- {
- public:
- BaseClass();
- ~BaseClass();
- short MiscFunc( short x );
- };
-
- class ChildClass : BaseClass
- {
- public:
- ChildClass();
- ~ChildClass();
- short MiscFunc( short x );
- };
-
-
- /*
- Other prototypes
- */
- void InitMacToolbox( void );
- void DoSomeOopStuff( void );
-
- main()
- {
- InitMacToolbox();
-
- /*
- initialize the logging system
- */
- LogInit( NULL, // default file location
- true, // delete the old file
- false, // don't flush the volume all the time
- true ); // start logging
-
- DoSomeOopStuff();
-
- /*
- Close the log file
- */
- LogDInit();
- }
-
- void DoSomeOopStuff( void )
- {
- ChildClass *p;
-
- /*
- Create an instance of ChildClass. This will call both constructors.
- */
- p = new( ChildClass );
- if ( !p ) return;
-
- /*
- The logger will show whether ChildClass::MiscFunc or BaseClass::MiscFunc
- is being called.
- */
- p->MiscFunc( 5 );
-
- /*
- Destroy the object. This will call both destructors.
- */
- delete( p );
- }
-
- // constructor
- BaseClass::BaseClass()
- {
- }
-
- // destructor
- BaseClass::~BaseClass()
- {
- }
-
- // some method
- short BaseClass::MiscFunc( short x )
- {
- return( x*2 );
- }
-
- // constructor
- ChildClass::ChildClass()
- {
- }
-
- // destructor
- ChildClass::~ChildClass()
- {
- }
-
- // override MiscFunc
- short ChildClass::MiscFunc( short x )
- {
- x = inherited::MiscFunc( x );
- return( x );
- }
-
-
- static void InitMacToolbox( void )
- {
- MaxApplZone();
- MoreMasters(); MoreMasters();
- InitGraf( &qd.thePort );
- InitFonts();
- InitWindows();
- InitCursor();
- InitMenus();
- InitDialogs( 0L );
- TEInit();
- FlushEvents( -1, 0 );
- }
-